﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ample.BLL;
using Ample.Model;

public partial class Users_Products : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void gvProducts_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            ProductBO pbo = new ProductBO();
            DataKey dk = gvProducts.DataKeys[Convert.ToInt32(e.CommandArgument)];
            Product prod = pbo.GetProductById(Convert.ToInt32(dk.Value));

            this.Profile.ShoppingCart.InsertItem(prod.ProductId, prod.Name, prod.Package, prod.Description, prod.Price);
            this.Response.Redirect("ShoppingCart.aspx", false);
        }
    }
}
